package com.devicemantra.coordinate.interfaces.email;

import java.util.Properties;
import javax.mail.Message;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

import com.devicemantra.coordinate.util.CLogger;


public class CSendEmail {
	
	public static void sendMail(String pTo, String pSubject, String pBody)
	{
		Properties props = new Properties();
        Session session = Session.getDefaultInstance(props, null);

        String msgBody = "...";

        try {
            Message msg = new MimeMessage(session);
            msg.setFrom(new InternetAddress("watchersparadise@gmail.com", "CoOrdinate"));
            msg.addRecipient(Message.RecipientType.TO,
                             new InternetAddress(pTo, pTo));
            msg.setSubject(pSubject);
            msg.setText(pBody);
            Transport.send(msg);
    
        } catch (Exception e) {
        	CLogger.log("Exception caught :"+ e);
        }
        }

}
